package net.sudot.chess.business.controller.admin;

import net.sudot.chess.business.controller.AbstractBaseController;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 错误页面
 *
 * @author tangjialin on 2018-01-27.
 */
@RestController("adminErrorController")
@RequestMapping(value = "/admin/error")
public class ErrorController extends AbstractBaseController {

    /**
     * 异常处理
     *
     * @param code 异常码
     * @return 返回异常信息
     */
    @PostMapping("/{code:\\d+}")
    public ResponseEntity<String> error(@PathVariable int code) {
        return ResponseEntity.status(code).build();
    }
}
